package com.tuling.mybaitis_spring;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
//@Component
@SuppressWarnings({"rawtypes", "unchecked"})
//public class ZhouyuFactoryBean implements FactoryBean {
public class ZhouyuFactoryBean {
	//使用构造注入
	private Class classInterface;

	public ZhouyuFactoryBean(Class classInterface) {
		this.classInterface = classInterface;
	}

	public Object getObject() throws Exception {
		Object proxyInstance =Proxy.newProxyInstance( ZhouyuFactoryBean.class.getClassLoader(),
				new Class[]{classInterface},
		new InvocationHandler() {
			@Override
			public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
				return null;
			}
		});
		return proxyInstance;
	}

	public Class<?> getObjectType() {
		return classInterface;
	}
}
